<!DOCTYPE HTML>
<title>Skipping up to the last frame of an animated gif shouldn't crash.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<img id="image" src="resources/three_frame_100ms.gif">
<script>
async_test(function(test) {
    image.onload = function() {
        setTimeout(function() {
            var start = performance.now();
            while (true) {
                // Block the main thread for 300ms.
                if (performance.now() - start >= 300)
                    break;
            }
            // Painting will force the gif to advance to the last frame.
            requestAnimationFrame(function() {
                test.done();
            });
        }, 30);
    }
});
</script>
